﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Uber.Messages
{
    partial class GameClientMessageHandler
    {
        public void OpenQuests()
        {
            Session.SendMessage(UberEnvironment.GetGame().GetQuestManager().SerializeQuestList(Session));
        }

        public void StartQuest()
        {
            uint QuestId = Request.PopWiredUInt();

            if (QuestId <= 0) { return; }

            UberEnvironment.GetGame().GetQuestManager().HandleQuest(QuestId, Session);
        }

        public void StopQuest()
        {
            UberEnvironment.GetGame().GetQuestManager().HandleQuest(0, Session);
        }

        public void AcceptNew()
        {
            UberEnvironment.GetGame().GetQuestManager().ActivateNextQuest(Session);
        }

        public void RegisterQuests()
        {
            RequestHandlers[3101] = new RequestHandler(OpenQuests);
            RequestHandlers[3102] = new RequestHandler(StartQuest);
            RequestHandlers[3106] = new RequestHandler(StopQuest);
            RequestHandlers[3107] = new RequestHandler(AcceptNew);
        }
    }
}
